package cn.sunxyz.data.db;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.ResultSetHandler;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * Created by yangrd on 2017/6/1.
 */
public class BasicSQLRunner implements SQLRunner {

    private QueryRunner queryRunner = null;

    public BasicSQLRunner(QueryRunner queryRunner) {
        this.queryRunner = queryRunner;
    }

    @Override
    public <T> T query(Connection conn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException {
        return queryRunner.query(conn, sql, rsh, params);
    }

    @Override
    public int update(Connection conn, String sql, Object... params) throws SQLException {
        return queryRunner.update(conn, sql, params);
    }
}
